#include "../include/stu.h"
void insert_s(){ //添加学生信息
    system("clear");
    printf("输入要添加的学生信息\n");
    printf("退出：quit\n");
    printf("学号\t姓名\t课程数\t课程\t学分\n");
    struct student *p1,*p2,*p3;
    p2 = (struct student *)malloc(sizeof(struct student));
    scanf("%s",p2->id);
    if(strcmp(p2->id,"quit") == 0)
        return ;
    scanf("%s %d",p2->name,&p2->num);
    for(int i=0; i<p2->num; i++){
        scanf("%d",&p2->class[i]);
    }
    scanf("%d",&p2->credit);
    if(head1 == NULL){
        head1 = p2;
        printf("success1\n");
    }else{
        p1 = head1;
        p3 = p1;
        while(p1 != NULL){
            if(strcmp(p1->id,p2->id)==0){
                printf("该学号存在，重新输入\n");
                return ;
            }
            p3 = p1;
            p1 = p1->next;
        }
        p3->next = p2;
        p2->next = NULL;
        printf("success2\n");
    }
}
